package com.example.userdataservice.controller;

import com.example.userdataservice.model.UserInfoVO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;
import java.util.concurrent.TimeUnit;

@RestController
@RequestMapping("api/user")
public class UserController {

    @RequestMapping("/info")
    public UserInfoVO userInfo(){
        return getUser();
    }

    private UserInfoVO getUser(){
        int i = new Random().nextInt(30);
        try {
            TimeUnit.MILLISECONDS.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return UserInfoVO.builder().age(i).username("爱丽丝").remark("梦游仙境").build();
    }

}
